package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyRecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class RecordAdapter extends StkProviderMultiAdapter<MyRecordBean> {

    public RecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(35));
        addItemProvider(new RecordProvider());
    }

    private class RecordProvider extends BaseItemProvider<MyRecordBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyRecordBean bean) {
            Glide.with(baseViewHolder.itemView).load(bean.getImg()).into((ImageView) baseViewHolder.getView(R.id.ivRecordItemImg));
            baseViewHolder.setText(R.id.tvRecordItemName, bean.getName());
            baseViewHolder.setText(R.id.tvRecordItemDuration, bean.getDuration());
            baseViewHolder.setText(R.id.tvRecordItemTime, bean.getTime());
        }
    }
}
